\hypertarget{Microfacet Models}{
}

\noindent In the previous section, the reflection models were based on empirical observations. Research in optics found that these models deviate from reality in a number of aspects. In this section, a more physically correct class of reflection models will be outlined. They are called {\it first principles} models because they apply basic laws of physics on a microscopic scale. The interaction of light on this microscopic scale in turn determines how the light gets reflected from the surface. The light interaction could be described by either wave or geometric optics, but only geometric optics based models are discussed in this research.

The models described here start by modeling the surface geometry at microscopic scale. Rather than providing an exact description of this structure, the assumption is made that the surface varies randomly in height and orientation of facets. With this assumption, it is possible to use statistical models to model surface structures.

\section{Surface Roughness Model}\label{sec:SRM}
There are two possible methods to represent the random surface. Both methods use small differently oriented areas in their representation, also called microfacets. The first method is to model the surface using a random process such as described by Beckmann and Spizzichino \cite{BeckmannSpizzichino}. They suggest to build the surface by using coin-flipping as a procedure to decide whether to increase, decrease one or two units or stay on the same level. Although the resulting surface will have a desirable randomness, it is very complex to derive reflectance models using this method. 

The second method uses distributions of primitive shapes to represent the surface. Asserting the assumption $\lambda^2 \ll da \ll dA$, where the wavelength of light $\lambda$, is much smaller than the facet area $da$, and the facet area $da$ is much smaller than the area $dA$ (which is a pixel on the surface), geometric optics can be used to derive the reflectance models. 

Torrance and Sparrow suggest to represent the surface as a composition of symmetric V-cavities, where each microfacet has a height much bigger than their width and the upper edges are all laying in the same plane \cite{TorranceSparrow}. In their original research, they used a simple Gaussian distribution:

	\begin{eqnarray*}
		D = e^{-(\alpha \sigma)^2}
	\end{eqnarray*}

\noindent where D is the proportionate number of microfacets oriented in the direction of $\alpha$ and $\sigma$ is the standard deviation. In our case,  the angle $\alpha$ would be the angle between the halfway vector $\vec{\mathbf{h}}$ and surface normal $\vec{\mathbf{n}}$.

Different distributions models have been proposed by Blinn \cite{Blinn} and Cook and Torrance \cite{DigitalModeling}. However, in this research we only use the distribution model proposed by Blinn.

\section{Geometric Optics}
The idea of describing the surface as a collection of microfacets is originally developed in the field of optics and radiation transfer. Microfacets with respect to computer graphics has first been addressed by Blinn \cite{Blinn}. He proposed that a model for computer simulation could be composed from the following factors:

\begin{itemize}
	\item{ The number of microfacets that are facing the orientation of the viewing direction, and the projected area of the facets into the viewing direction. This is computed by the slope distribution function. }
	\item{ How much can an unobstructed microfacet reflect? This is mainly dependent on a given reflectance function for the microfacet. Generally, this is  either Lambertian or pure specular. See figure \ref{fig:GAF}(a) for an example using pure specular reflectance}
	\item{ How much incoming light on a microfacet gets blocked by other microfacets, causing shadows to appear on the blocked microfacet when observing the microfacet from certain angles (see figure \ref{fig:GAF}(b)).} 
	\item{ How much reflected light into the viewing direction gets blocked by other microfacets, causing the amount of radiance reaching the viewer to be smaller than the amount of radiance that gets reflected from the microfacet. This phenomenon is called masking, and is also shown in figure \ref{fig:GAF}(c). }
\end{itemize}

The shadowing and masking of the microfacets need additional geometric analysis next to the slope distribution. The most common way to deal with this analysis is to assume that the microfacets form V-shaped cavities as shown in the example images. This approach has been challenged since the assumption is inconsistent with the assumption of a random looking surface, but it simplifies geometric analysis.

Another case of geometric analysis which can be included, is the phenomenon of interreflection. This happens when radiance is being exchanged between two diffuse surfaces, and causes the effect of color bleeding. The analysis is included in the reflection model proposed by Oren and Nayar, and is described in section \ref{sec:OrenNayar}.

\begin{figure}[H]
	\begin{center}
		\subfigure[Unblocked]{\epsfig{file=images/MicroNoObstruction.eps, width=0.4\linewidth}}
		\subfigure[Shadowing]{\epsfig{file=images/MicroShading.eps, width=0.4\linewidth}}
		\subfigure[Masking]{\epsfig{file=images/MicroMasking.eps, width=0.4\linewidth}}
		\subfigure[Interreflection]{\epsfig{file=images/MicroInterreflection.eps, width=0.4\linewidth}}
	\end{center}
	\caption{{\it Four cases of light interaction on microfacets. The top-left of each image shows the direction of the viewer ($\vec{\mathbf{v}}$), surface normal ($\vec{\mathbf{n}}$) and light source ($\vec{\mathbf{l}}$).}}
	\label{fig:GAF}
\end{figure}


\section{Torrance-Sparrow Reflectance}\label{sec:CookTorrance}
	The results of experiments conducted by Sparrow and Torrance \cite{TorranceSparrow} showed that Phong reflectance closely simulates the behavior of the specular component on shiny/glossy surfaces. However, some differences were reported, with the main difference being that the specular bump varies with the direction of the light source. Also, the specular reflection is not always reflected in the halfway vector $\vec{\mathbf{h}}$. 

Torrance and Sparrow derived models to explain these differences, and Blinn translated these models to be useful in computer graphics. The specular component can be described as a function of four factors: 
	
	\begin{eqnarray*}
		f_r = \frac{F(\theta_h)D(\theta_h)G(\theta_i,\theta_r)}{\vec{\mathbf{n}} \cdot \vec{\mathbf{v}}}
	\end{eqnarray*}

\noindent where $D$ is the distribution function of the directions of the microfacets. Each microfacet is assumed to be perfectly specular. $G$ contributes the amount of light that gets masked and/or shaded by other microfacets, and $F$ is the Fresnel reflection law. All three components will be addressed in this section.

Taking into account that the observer sees more of the microfacet surface area when the surface is tilted, this tilt angle is included in the division in the above equation as $\vec{\mathbf{n}} \cdot \vec{\mathbf{e}}$, since this observed area is inversely proportional to the cosine of the tilt angle.

The distribution function used by Torrance and Sparrow was a simple Gaussian function as explained in section \ref{sec:SRM}. Blinn used a different distribution function, developed by Trowbridge and Reitz \cite{TrowbridgeReitz}, and suggests modeling the microfacet distribution as ellipsoids:

	\begin{eqnarray*}
		D_{Blinn}(\theta_h) = \left({ \frac{m^2}{\cos^2(\theta_h)(m^2-1)+1} } \right)^2
	\end{eqnarray*}

\noindent In the above equation, the parameter $m$ controls the eccentricity of the ellipsoids. When set to 0, the distribution defines a shiny surface, and when set to 1, it defines a rough surface.

The factor $G$ in the specular reflection equation accounts for the effect of masking and shadowing of microfacets. This factor is also called the \textit{geometrical attenuation factor}, and gives a value between 0 and 1 to represent the amount of light remaining after shadowing/masking. The method described by Blinn to calculate this factor assumes symmetrical identical V-shaped cavities as stated earlier. 

The three cases are included in the geometrical attenuation factor. For arbitrary light source directions and viewing directions, the three cases that can happen are shown in figure \ref{fig:GAF}.

The first case is that of figure \ref{fig:GAF}a, where no light is obstructed by other microfacets and therefore there is no attenuation. In this case, the attenuation is simply defined as:

	\begin{eqnarray*}
		G_a = 1
	\end{eqnarray*}

In the case of figure \ref{fig:GAF}b, some of the incident light gets intercepted when traveling to the observer. For this case, the attenuation is defined as follows:

	\begin{eqnarray*}
		G_b = \frac{2\cos(\theta_h)\cos(\theta_r)}{\cos(\theta_{rh})}
	\end{eqnarray*}

\noindent Because the same concept applies for figure \ref{fig:GAF}c, but the light and view source are interchanged, the final attenuation can be defined as:

	\begin{eqnarray*}
		G_c = \frac{2\cos(\theta_h)\cos(\theta_i)}{\cos(\theta_{rh})}
	\end{eqnarray*}

\noindent For the exact derivation of these individual terms, the work of Blinn \cite{Blinn} can be consulted. For the implementation of $GAF$, the minimum of all three cases is used as the effective value for $G$:

	\begin{eqnarray*}
		G = min \left[ {G_a, min \left[ {G_b, G_c} \right] } \right]
	\end{eqnarray*}

\noindent The final term in the specular reflection equation is the Fresnel term. This term gives the fraction of light that is reflected from a microfacet instead of being absorbed. An object's surface is considered an interface between two different substances; the object's substance and the substance the object is surrounded with (eg. water or in this case air). The Fresnel equations, developed by Augustin-Jean Fresnel in the 19th century, describe an optical property such that reflected light is not only dependent on the incoming light angle $\theta_i$, but also on the \textit{refraction index} of both substances. The exact Fresnel equations are quite complex and need correct refraction indices which are not available for the PhoTex database. 

A simplified version of the Fresnel equations is given by Schlick \cite{Schlick}, which is proven to be fairly accurate for a lot of substances and is given by the equation:

	\begin{eqnarray*}
		F(\theta_i) = R_f(0^o) + (1 - R_f(0^o))(1 - \cos(\theta_i))^5
	\end{eqnarray*}

\noindent in this equation, $R_f(0^o)$ represents the specular color of a substance when the incident light strikes the surface under an angle of $\theta_i = 0$. This value for $R_f(0^o)$ is typically low for dielectrics such as plastic, stone, wood, concrete, leather, etc. and is measured around 0.05 or lower \cite{RTR}. 


\section{Oren-Nayar Reflectance}\label{sec:OrenNayar}
A big deficiency in approximating the body reflectance under the Lambertian assumption is that it is view independent. This results in inaccurate approximations for several real-world objects, as experiments have demonstrated on rough diffuse surfaces such as plaster, sand and clothing \cite{OrenNayar}. The main issue with Lambertian reflection for diffuse objects is that it creates high contrasts around the occluding boundaries of an object.

To overcome this deficiency, M. Oren and S.K. Nayar propose a more general reflection model for diffuse surfaces \cite{OrenNayar} \cite{ImprovedDiffuse}, which borrows ideas from modeling the surface as a collection of microfacets as proposed for the Cook-Torrance or Torrance-Sparrow models. Microfacets are assumed to be perfectly Lambertian in reflection. This does not imply that surfaces are reflecting perfectly Lambertian however, since the combination of all factors included produces accurate diffuse reflection also for non-Lambertian diffuse surfaces. 

The general form of the equation consists of two part:

	\begin{eqnarray*}
		f_r = f_r^1 + f_r^2
	\end{eqnarray*}

\noindent The first part of the equation, $f_r^1$ accounts for the amount of radiance that is projected on the facets, and includes analysis for the geometric attenuation factor. The second part, $f_r^2$ accounts for radiance caused by interreflections.

%In their original paper, Oren and Nayar discussed various slope distributions for the distribution of of microfacets. Using an uni-directional single-slope distribution (representing an anisotropic surface), they derive a geometric attenuation factor similar to that derived by Torrance and Sparrow. Their analysis continues by considering distributions for isotropic surfaces. However, those distribution models assume equal slopes for all microfacets, which isn't realistic. 

For the modeling of a surface, they propose to use a Gaussian Slope-Area distribution $P(\phi_a, \theta_a)$, where the parameter $\theta_a$ is the standard deviation, and is a measurement for the roughness of the material. Because evaluating the complete integral using the Gaussian Slope-Area distribution turns out to be too difficult, approximations of this integral were made using numerical evaluations. The resulting equations are therefore not a result of analysis: 


	\begin{eqnarray*}
		f_r^1 = \frac{\rho}{\pi}L_i\cos(\theta_i)\left[C_1+\cos(\phi_r-\phi_i)C_2\tan(\beta) 
			  + (1-|\cos(\phi_r-\phi_i)|)C_3\tan\left(\frac{\alpha+\beta}{2}\right)\right]
	\end{eqnarray*}

\noindent with the coefficients defined as:

	\begin{eqnarray*}
		C_1 = 1 - 0.5\frac{\sigma^2}{\sigma^2+0.33}
	\end{eqnarray*}

	\begin{eqnarray*}
		C_2 =
			\begin{cases}
				0.45\frac{\sigma^2}{\sigma^2+0.09} 		& \quad \text{if $\cos(\phi_r - \phi_i) \geq 0$}\\
				0.45\frac{\sigma^2}{\sigma^2+0.09} \left( \sin(\alpha) - \left( \frac{2\beta}{\pi}\right)\right) 	& \quad \text{otherwise}\\
			\end{cases}
	\end{eqnarray*}

	\begin{eqnarray*}
		C_3 = 0.125 \left( \frac{\sigma^2}{\sigma^2+0.09} \right)\left( \frac{4\alpha\beta}{\pi^2} \right)
	\end{eqnarray*}

\noindent In these equations $\sigma$ is the coefficient controlling the surface roughness. A low $\sigma$ models a smooth surface, with $\sigma=0$ giving a perfect Lambertian surface and a high $\sigma$ models a rough surface with $\sigma=1$ being the maximum roughness value. $\alpha$ is defined as $\max(\theta_r, \theta_i)$ and $\beta$ is defined as $\min(\theta_r, \theta_i)$.

Since the energy of a light ray diminishes quickly on Lambertian surfaces, they consider interreflection up to two bounces. The same approach of finding a good approximation accounts for defining the interreflection term:

	\begin{eqnarray*}
		f_r^2 = 0.17\frac{\rho^2}{\pi}L_i\cos(\theta_i)\frac{\sigma^2}{\sigma^2+0.13}\left[1-\cos(\phi_r-\phi_i)\left( \frac{2\beta}{\pi} \right)^2 \right]
	\end{eqnarray*}

The main difference in diffuse reflection with respect to the Lambertian reflection model is that the Oren-Nayar model simulates incident light reflected back towards the light source. When light falls upon a diffuse rough surface with Lambertian microfacets, the microfacets oriented in the direction of the light source will receive more incident light than other the microfacets and would appear brighter when observed. In figure \ref{fig:Backscatter}(a) both microfacets are fully illuminated by the light source. However, since microfacet A receives more incident light than microfacet B, microfacet A will appear more bright and microfacet B more dark. When observing the surface from a point such that the angle between viewing direction and light source direction is relatively large, the observer perceives more of the dark microfacet B than the bright microfacet A, as shown in figure \ref{fig:Backscatter}(b). When the observers moves towards the direction of the light source, thus making the angle between the viewing direction and the light source direction smaller, the observer will gradually perceive more of the brighter microfacet A, as shown in figure \ref{fig:Backscatter}(c).


This phenomenon is called backscattering and causes the observation to have less contrast when angle between the viewpoint direction and light source direction is small. The Oren-Nayar model could potentially deal with the hard contrast that is created by Lambertian reflectance.

A more simplified version was proposed by the authors \cite{OrenNayar}, leaving out the interreflection term, since the above equations are too complex to apply in rendering software in general. In this research however, we aim at simulating reflection as close to real light interaction as possible, thus the choice was made to use the original model for the Gaussian Slope-Area distribution.

\begin{figure}[ht]
	\begin{center}
		\subfigure[]{\epsfig{file=images/Backscatter1.eps, width=0.3\linewidth}}

		\subfigure[]{\epsfig{file=images/Backscatter2.eps, width=0.3\linewidth}}
		\subfigure[]{\epsfig{file=images/Backscatter3.eps, width=0.3\linewidth}}
	\end{center}
	\caption{{\it Backscattering of light. The perceived radiant exitance increases when the viewer moves towards the light source direction.}}
	\label{fig:Backscatter}
\end{figure}


\begin{figure}[ht]
	\begin{center}
		\subfigure[adb]{\epsfig{file=images/rendered/adb.0.60.210.PhoTex.eps, width=0.2\linewidth}}
		\subfigure[adh]{\epsfig{file=images/rendered/adh.0.45.240.PhoTex.eps, width=0.2\linewidth}}

		\subfigure[Oren-Nayar]{\epsfig{file=images/rendered/adb.0.60.210.OrenNayar.eps, width=0.2\linewidth}}
		\subfigure[Torrance-Sparrow]{\epsfig{file=images/rendered/adh.0.45.240.TorranceSparrow.eps, width=0.2\linewidth}}\label{fig:aab1}
	\end{center}
	\caption{{\it Examples of original and their respective synthetic images. The top row shows the original images and the bottom row shows images the synthetic images.}}
	\label{fig:RenderExamples2}
\end{figure}

